import Vue from 'vue'
import App from './App.vue'


import { Button, Input, Icon, Card, message,Tabs,Upload,Avatar,Modal,FormModel,Spin,Select  } from 'ant-design-vue';
import 'ant-design-vue/dist/antd.css';
Vue.config.productionTip = false
Vue.use(Button);
Vue.use(Input);
Vue.use(Icon);
Vue.use(Card);
Vue.use(Tabs);
Vue.use(Upload);
Vue.use(Avatar);
Vue.use(Modal);
Vue.use(FormModel);
Vue.use(Spin);
Vue.use(Select);

import VueCropper from 'vue-cropper'
Vue.use(VueCropper)


Vue.prototype.$message = message;
let task = null 
let app = null 





task = setInterval(()=>{
  // 直接作为html 显示时，为屏蔽pywebview api 创建代理对象，访问其任何属性 均返回promise
  if(typeof pywebview == "undefined"){
    if(typeof Vue.prototype.$api != "undefined"){
      return 
    }
    let api = {}
    api = new Proxy(api,{
        get:(key)=> ()=> new Promise((resolve) => {
            resolve(false);
        })
    })
    Vue.prototype.$api = api;
    app = new Vue({
      render: h => h(App),
    }).$mount('#app')
  }
  if(typeof pywebview != "undefined"){
    console.log = pywebview.api.log
    console.error = pywebview.api.log
    Vue.prototype.$api = pywebview.api;
    if(app == null){
      app = new Vue({
        render: h => h(App),
      }).$mount('#app')
    }
  }
},500)
